package bancosys.tec.job;

import bancosys.tec.exception.LocalizedMessageHolder;
import bancosys.tec.exception.MessageCreator;
import bancosys.tec.exception.MessageCreatorHelper;

/**
 * @author lundberg
 */
public enum JobMessages implements MessageCreator {
    ELEMENT_ALREADY_EXECUTED(0, "job.elementAlreadyExecuted"),

    ERROR_ACQUIRING_JOB(1, "job.errorAcquiringJob"),

    PROCESSING_UNIT_NOT_FOUND(0, "job.processingUnitNotFound"),

    ERROR_SENDING_TO_QUEUE(2, "job.errorSendingJobToQueue"),

    ERROR_PROCESSING_JOB(2, "job.errorProcessingJob"),

    GENERIC_EXECUTION_ERROR(0, "job.genericJobExecutionError"),

    MESSAGE_OBJECT_NOT_AJOB(2, "job.messageObjectNotAJob"),

    ERROR_CLOSING_QUEUE(1, "job.errorClosingQueue"),

    WRONG_MESSAGE_TYPE(2, "job.wrongMessageType");

    private final MessageCreator delegate;

    /**
     * Construtor
     * 
     * @param nargs nargs
     * @param key key
     */
    private JobMessages(int nargs, String key) {
        this.delegate = MessageCreatorHelper.creator("jmine-tec-job-messages", key, nargs);
    }

    /**
     * {@inheritDoc}
     */
    public LocalizedMessageHolder create(Object... arguments) {
        return this.delegate.create(arguments);
    }

    /**
     * {@inheritDoc}
     */
    public int getExpectedArguments() {
        return this.delegate.getExpectedArguments();
    }
}
